package com.tywj.panda.customer.common.tool

import android.content.Context
import android.util.Log
import java.util.*

/**
 * <pre>
 *     author : June Yang
 *     time   : 2020/5/27
 *     desc   : 导航用到的工具类
 *     version: 2.0.0
 * </pre>
 */
object NavigationTool {

    //检查是否安装
    fun isInstalled(packageName: String, mContext: Context): Boolean {
        val packageManager = mContext.packageManager // 获取packagemanager
        val pinfo =
            packageManager.getInstalledPackages(0) // 获取所有已安装程序的包信息
        if (pinfo != null) {
            for (i in pinfo.indices) {
                val pn = pinfo[i].packageName.toLowerCase(Locale.ENGLISH)
                Log.i("PACKAGE", pn)
                if (pn == packageName) {
                    return true
                }
            }
        }
        return false
    }
}